﻿ /****** Object:  ForeignKey [FK__CO_SO_HA___MA_HO__40F9A68C]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CO_SO_HA___MA_HO__40F9A68C]') AND parent_object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]'))
ALTER TABLE [dbo].[CO_SO_HA_TANG] DROP CONSTRAINT [FK__CO_SO_HA___MA_HO__40F9A68C]
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__HUONG__41EDCAC5]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__HUONG__41EDCAC5]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__HUONG__41EDCAC5]
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__LOAI___42E1EEFE]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___42E1EEFE]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__LOAI___42E1EEFE]
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__LOAI___43D61337]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___43D61337]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__LOAI___43D61337]
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__MA_HO__44CA3770]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__MA_HO__44CA3770]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__MA_HO__44CA3770]
GO
/****** Object:  ForeignKey [FK__DUONG_KHA__PHUON__46B27FE2]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHA__PHUON__46B27FE2]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT] DROP CONSTRAINT [FK__DUONG_KHA__PHUON__46B27FE2]
GO
/****** Object:  ForeignKey [FK__DUONG_KHAO__QUAN__45BE5BA9]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHAO__QUAN__45BE5BA9]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT] DROP CONSTRAINT [FK__DUONG_KHAO__QUAN__45BE5BA9]
GO
/****** Object:  ForeignKey [FK__GIA_DOAN___MA_DK__47A6A41B]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_DOAN___MA_DK__47A6A41B]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_DOAN_DUONG]'))
ALTER TABLE [dbo].[GIA_DOAN_DUONG] DROP CONSTRAINT [FK__GIA_DOAN___MA_DK__47A6A41B]
GO
/****** Object:  ForeignKey [FK__GIA_THAM___LOAI___489AC854]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___LOAI___489AC854]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH] DROP CONSTRAINT [FK__GIA_THAM___LOAI___489AC854]
GO
/****** Object:  ForeignKey [FK__GIA_THAM___MA_HO__498EEC8D]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___MA_HO__498EEC8D]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH] DROP CONSTRAINT [FK__GIA_THAM___MA_HO__498EEC8D]
GO
/****** Object:  ForeignKey [FK__HO_SO_THA__MA_DK__4A8310C6]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__MA_DK__4A8310C6]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] DROP CONSTRAINT [FK__HO_SO_THA__MA_DK__4A8310C6]
GO
/****** Object:  ForeignKey [FK__HO_SO_THA__TINH___4C6B5938]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__TINH___4C6B5938]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] DROP CONSTRAINT [FK__HO_SO_THA__TINH___4C6B5938]
GO
/****** Object:  ForeignKey [FK__THONG_TIN__MA_HO__4D5F7D71]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THONG_TIN__MA_HO__4D5F7D71]') AND parent_object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]'))
ALTER TABLE [dbo].[THONG_TIN_VI_TRI] DROP CONSTRAINT [FK__THONG_TIN__MA_HO__4D5F7D71]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_D__4E53A1AA]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_D__4E53A1AA]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_D__4E53A1AA]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_H__4F47C5E3]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__4F47C5E3]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_H__4F47C5E3]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_H__503BEA1C]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__503BEA1C]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_H__503BEA1C]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_L__51300E55]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_L__51300E55]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_L__51300E55]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__MA_HO___5224328E]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__MA_HO___5224328E]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__MA_HO___5224328E]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___531856C7]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___531856C7]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___531856C7]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___540C7B00]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___540C7B00]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___540C7B00]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___55009F39]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55009F39]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___55009F39]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___55F4C372]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55F4C372]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___55F4C372]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___56E8E7AB]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___56E8E7AB]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___56E8E7AB]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___57DD0BE4]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___57DD0BE4]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___57DD0BE4]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___58D1301D]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___58D1301D]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___58D1301D]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___MA_HO__59C55456]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___MA_HO__59C55456]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___MA_HO__59C55456]
GO
/****** Object:  Table [dbo].[GIA_THAM_DINH]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___LOAI___489AC854]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH] DROP CONSTRAINT [FK__GIA_THAM___LOAI___489AC854]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___MA_HO__498EEC8D]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH] DROP CONSTRAINT [FK__GIA_THAM___MA_HO__498EEC8D]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]') AND type in (N'U'))
DROP TABLE [dbo].[GIA_THAM_DINH]
GO
/****** Object:  Table [dbo].[CO_SO_HA_TANG]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CO_SO_HA___MA_HO__40F9A68C]') AND parent_object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]'))
ALTER TABLE [dbo].[CO_SO_HA_TANG] DROP CONSTRAINT [FK__CO_SO_HA___MA_HO__40F9A68C]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]') AND type in (N'U'))
DROP TABLE [dbo].[CO_SO_HA_TANG]
GO
/****** Object:  Table [dbo].[CONG_TRINH_XAY_DUNG]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__HUONG__41EDCAC5]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__HUONG__41EDCAC5]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___42E1EEFE]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__LOAI___42E1EEFE]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___43D61337]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__LOAI___43D61337]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__MA_HO__44CA3770]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] DROP CONSTRAINT [FK__CONG_TRIN__MA_HO__44CA3770]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]') AND type in (N'U'))
DROP TABLE [dbo].[CONG_TRINH_XAY_DUNG]
GO
/****** Object:  Table [dbo].[THONG_TIN_VI_TRI]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THONG_TIN__MA_HO__4D5F7D71]') AND parent_object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]'))
ALTER TABLE [dbo].[THONG_TIN_VI_TRI] DROP CONSTRAINT [FK__THONG_TIN__MA_HO__4D5F7D71]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]') AND type in (N'U'))
DROP TABLE [dbo].[THONG_TIN_VI_TRI]
GO
/****** Object:  Table [dbo].[THUA_DAT]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_D__4E53A1AA]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_D__4E53A1AA]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__4F47C5E3]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_H__4F47C5E3]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__503BEA1C]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_H__503BEA1C]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_L__51300E55]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__LOAI_L__51300E55]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__MA_HO___5224328E]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] DROP CONSTRAINT [FK__THUA_DAT__MA_HO___5224328E]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THUA_DAT]') AND type in (N'U'))
DROP TABLE [dbo].[THUA_DAT]
GO
/****** Object:  Table [dbo].[VAT_LIEU_XAY_DUNG]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___531856C7]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___531856C7]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___540C7B00]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___540C7B00]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55009F39]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___55009F39]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55F4C372]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___55F4C372]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___56E8E7AB]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___56E8E7AB]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___57DD0BE4]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___57DD0BE4]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___58D1301D]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___LOAI___58D1301D]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___MA_HO__59C55456]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] DROP CONSTRAINT [FK__VAT_LIEU___MA_HO__59C55456]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]') AND type in (N'U'))
DROP TABLE [dbo].[VAT_LIEU_XAY_DUNG]
GO
/****** Object:  Table [dbo].[GIA_DOAN_DUONG]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_DOAN___MA_DK__47A6A41B]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_DOAN_DUONG]'))
ALTER TABLE [dbo].[GIA_DOAN_DUONG] DROP CONSTRAINT [FK__GIA_DOAN___MA_DK__47A6A41B]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF__GIA_DOAN___ACTIV__797309D9]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[GIA_DOAN_DUONG] DROP CONSTRAINT [DF__GIA_DOAN___ACTIV__797309D9]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GIA_DOAN_DUONG]') AND type in (N'U'))
DROP TABLE [dbo].[GIA_DOAN_DUONG]
GO
/****** Object:  Table [dbo].[HO_SO_THAM_DINH]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__MA_DK__4A8310C6]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] DROP CONSTRAINT [FK__HO_SO_THA__MA_DK__4A8310C6]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__TINH___4C6B5938]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] DROP CONSTRAINT [FK__HO_SO_THA__TINH___4C6B5938]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF__HO_SO_THA__ACTIV__7C4F7684]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[HO_SO_THAM_DINH] DROP CONSTRAINT [DF__HO_SO_THA__ACTIV__7C4F7684]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]') AND type in (N'U'))
DROP TABLE [dbo].[HO_SO_THAM_DINH]
GO
/****** Object:  Table [dbo].[DUONG_KHAO_SAT]    Script Date: 09/17/2011 12:23:38 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHA__PHUON__46B27FE2]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT] DROP CONSTRAINT [FK__DUONG_KHA__PHUON__46B27FE2]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHAO__QUAN__45BE5BA9]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT] DROP CONSTRAINT [FK__DUONG_KHAO__QUAN__45BE5BA9]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF__DUONG_KHA__ACTIV__6EF57B66]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[DUONG_KHAO_SAT] DROP CONSTRAINT [DF__DUONG_KHA__ACTIV__6EF57B66]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]') AND type in (N'U'))
DROP TABLE [dbo].[DUONG_KHAO_SAT]
GO
/****** Object:  Table [dbo].[THAM_SO]    Script Date: 09/17/2011 12:23:39 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THAM_SO]') AND type in (N'U'))
DROP TABLE [dbo].[THAM_SO]
GO
/****** Object:  Table [dbo].[THAM_SO]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THAM_SO]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[THAM_SO](
	[MA_THAM_SO] [bigint] IDENTITY(1,1) NOT NULL,
	[PARENT_ID] [bigint] NULL,
	[LOAI_THAM_SO] [nvarchar](50) NULL,
	[NOI_DUNG] [nvarchar](255) NULL,
	[SEQUENCE] [int] NULL,
	[GHI_CHU] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_THAM_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[DUONG_KHAO_SAT]    Script Date: 09/17/2011 12:23:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DUONG_KHAO_SAT](
	[MA_DKS] [bigint] IDENTITY(1,1) NOT NULL,
	[QUAN] [bigint] NULL,
	[PHUONG] [bigint] NULL,
	[DUONG] [nvarchar](50) NULL,
	[DOAN_DUONG] [nvarchar](50) NULL,
	[NGAY_KHOI_TAO] [datetime] NULL,
	[ACTIVE_FLAG] [char](1) NULL DEFAULT ('Y'),
PRIMARY KEY CLUSTERED 
(
	[MA_DKS] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[HO_SO_THAM_DINH]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[HO_SO_THAM_DINH](
	[MA_HO_SO] [bigint] IDENTITY(1,1) NOT NULL,
	[MA_DKS] [bigint] NULL,
	[SO_PHIEU] [nvarchar](255) NULL,
	[TEN_CHU_SU_DUNG] [nvarchar](255) NULL,
	[DIA_CHI] [nvarchar](255) NULL,
	[GPS_LATITUDE] [float] NULL,
	[GPS_LONGTITUDE] [float] NULL,
	[GPS_CHI_CHU] [nvarchar](255) NULL,
	[TINH_TRANG_PHAP_LY] [bigint] NULL,
	[NOI_DUNG_PHAP_LY] [nvarchar](255) NULL,
	[LOAI_KHU_VUC_KINH_DOANH] [int] NULL,
	[Y_KIEN_THAM_DINH] [nvarchar](1023) NULL,
	[GIA_DAT_1] [float] NULL,
	[GIA_DAT_2] [float] NULL,
	[GIA_DAT_BINH_QUAN_1] [float] NULL,
	[GIA_DAT_BINH_QUAN_2] [float] NULL,
	[NGUOI_CAP_NHAT] [uniqueidentifier] NULL,
	[NGUOI_KHOI_TAO] [uniqueidentifier] NULL,
	[NGAY_KHOI_TAO] [datetime] NULL,
	[NGAY_CAP_NHAT] [datetime] NULL,
	[ACTIVE_FLAG] [char](1) NULL CONSTRAINT [DF__HO_SO_THA__ACTIV__7C4F7684]  DEFAULT ('Y'),
 CONSTRAINT [PK__HO_SO_THAM_DINH__7B5B524B] PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[GIA_DOAN_DUONG]    Script Date: 09/17/2011 12:23:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GIA_DOAN_DUONG]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GIA_DOAN_DUONG](
	[MA_GDD] [bigint] IDENTITY(1,1) NOT NULL,
	[MA_DKS] [bigint] NULL,
	[GIA_DAT] [float] NULL,
	[NGUOI_KHOI_TAO] [uniqueidentifier] NULL,
	[NGAY_KHOI_TAO] [datetime] NULL,
	[NGAY_CAP_NHAT] [datetime] NULL,
	[ACTIVE_FLAG] [char](1) NULL DEFAULT ('Y'),
PRIMARY KEY CLUSTERED 
(
	[MA_GDD] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[VAT_LIEU_XAY_DUNG]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[VAT_LIEU_XAY_DUNG](
	[MA_HO_SO] [bigint] NOT NULL,
	[LOAI_KET_CAU_KHUNG] [bigint] NULL,
	[NOI_DUNG_KET_CAU_KHUNG] [nvarchar](50) NULL,
	[LOAI_KET_CAU_MONG] [bigint] NULL,
	[NOI_DUNG_KET_CAU_MONG] [nvarchar](50) NULL,
	[LOAI_KET_CAU_TUONG_NHA] [bigint] NULL,
	[NOI_DUNG_KET_CAU_TUONG_NHA] [nvarchar](50) NULL,
	[LOAI_KET_CAU_NEN] [bigint] NULL,
	[NOI_DUNG_KET_CAU_NEN] [nvarchar](50) NULL,
	[LOAI_KET_CAU_MAI] [bigint] NULL,
	[NOI_DUNG_KET_CAU_MAI] [nvarchar](50) NULL,
	[CHAT_LUONG_MONG] [float] NULL,
	[CHAT_LUONG_SAN] [float] NULL,
	[CHAT_LUONG_TUONG] [float] NULL,
	[CHAT_LUONG_TRAN] [float] NULL,
	[CHAT_LUONG_MAI] [float] NULL,
	[TI_LE_KET_CAU_MONG] [float] NULL,
	[TI_LE_KET_CAU_SAN] [float] NULL,
	[TI_LE_KET_CAU_TUONG] [float] NULL,
	[TI_LE_KET_CAU_TRAN] [float] NULL,
	[TI_LE_KET_CAU_MAI] [float] NULL,
	[SO_PHONG_NGU] [int] NULL,
	[SO_NHA_VE_SINH] [int] NULL,
	[LOAI_TRANG_TRI_NOI_THAT] [bigint] NULL,
	[NOI_DUNG_TRANG_TRI_NOI_THAT] [nvarchar](50) NULL,
	[LOAI_CONG_TRINH_XAY_DUNG] [bigint] NULL,
	[NOI_DUNG_CONG_TRINH_XAY_DUNG] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[THUA_DAT]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THUA_DAT]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[THUA_DAT](
	[MA_HO_SO] [bigint] NOT NULL,
	[SO_THUA_DAT] [nvarchar](50) NULL,
	[TO_BAN_DO] [nvarchar](50) NULL,
	[CHIEU_DAI] [float] NULL,
	[CHIEU_RONG] [float] NULL,
	[TONG_DIEN_TICH] [float] NULL,
	[DIEN_TICH_CONG_NHAN] [float] NULL,
	[DIEN_TICH_KHONG_CONG_NHAN] [float] NULL,
	[DIEN_TICH_SU_DUNG_CHUNG] [float] NULL,
	[LOAI_HINH_DANG_THUA_DAT] [bigint] NULL,
	[HINH_DANG_THUA_DAT] [nvarchar](50) NULL,
	[LOAI_DUONG_PHO] [bigint] NULL,
	[LO_GIOI] [float] NULL,
	[SO_MAT_TIEN] [nvarchar](50) NULL,
	[LOAI_LAN_DUONG] [bigint] NULL,
	[NOI_DUNG_LAN_DUONG] [nvarchar](50) NULL,
	[LOAI_HEM] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[THONG_TIN_VI_TRI]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[THONG_TIN_VI_TRI](
	[MA_HO_SO] [bigint] NOT NULL,
	[CACH_TRUNG_TAM] [float] NULL,
	[CACH_DUONG_CHINH] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[CONG_TRINH_XAY_DUNG]    Script Date: 09/17/2011 12:23:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[CONG_TRINH_XAY_DUNG](
	[MA_HO_SO] [bigint] NOT NULL,
	[LOAI_NHA] [bigint] NULL,
	[NOI_DUNG_LOAI_NHA] [nvarchar](50) NULL,
	[LOAI_CAP_NHA] [bigint] NULL,
	[HUONG_NHA] [bigint] NULL,
	[GIAY_PHEP_XAY_DUNG] [char](1) NULL,
	[DIEN_TICH_XD_CONG_NHAN] [float] NULL,
	[DIEN_TICH_XD_KHONG_CONG_NHAN] [float] NULL,
	[NAM_XAY_DUNG] [datetime] NULL,
	[SO_NAM_SU_DUNG] [float] NULL,
	[DON_GIA_XAY_DUNG] [float] NULL,
	[TUOI_DOI_KINH_TE] [float] NULL,
	[GIA_TRI_CONG_TRINH] [float] NULL,
	[SO_LAN_SUA_CHUA] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CO_SO_HA_TANG]    Script Date: 09/17/2011 12:23:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[CO_SO_HA_TANG](
	[MA_HO_SO] [bigint] NOT NULL,
	[DONG_HO_DIEN] [int] NULL,
	[CAP_TREO] [int] NULL,
	[CAP_NGAM] [int] NULL,
	[DONG_HO_NUOC] [int] NULL,
	[AP_LUC_NUOC] [int] NULL,
	[CHAT_LUONG_NUOC] [int] NULL,
	[TIENG_ON] [int] NULL,
	[KHOI_BUI] [int] NULL,
	[TINH_TRANG_NGAP] [int] NULL,
	[HE_THONG_CHIEU_SANG] [int] NULL,
	[CHOT_BAO_VE] [int] NULL,
	[AN_NINH] [int] NULL,
	[GAN_CO_SO_GIAO_DUC] [int] NULL,
	[GAN_CO_SO_Y_TE] [int] NULL,
	[GAN_CHO_TRUNG_TAM] [int] NULL,
	[GAN_CO_SO_GIAI_TRI] [int] NULL,
	[GAN_DICH_VU_CONG_CONG] [int] NULL,
	[GAN_THONG_TIN_LIEN_LAC] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[GIA_THAM_DINH]    Script Date: 09/17/2011 12:23:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GIA_THAM_DINH](
	[MA_HO_SO] [bigint] NOT NULL,
	[GIA_GIAO_DICH_TRIEU_DONG] [float] NULL,
	[GIA_GIAO_DICH_CAY_VANG] [float] NULL,
	[THOI_DIEM_GIAO_DICH] [datetime] NULL,
	[LOAI_THANH_TOAN] [bigint] NULL,
	[NOI_DUNG_THANH_TOAN] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MA_HO_SO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  ForeignKey [FK__CO_SO_HA___MA_HO__40F9A68C]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CO_SO_HA___MA_HO__40F9A68C]') AND parent_object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]'))
ALTER TABLE [dbo].[CO_SO_HA_TANG]  WITH CHECK ADD  CONSTRAINT [FK__CO_SO_HA___MA_HO__40F9A68C] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CO_SO_HA___MA_HO__40F9A68C]') AND parent_object_id = OBJECT_ID(N'[dbo].[CO_SO_HA_TANG]'))
ALTER TABLE [dbo].[CO_SO_HA_TANG] CHECK CONSTRAINT [FK__CO_SO_HA___MA_HO__40F9A68C]
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__HUONG__41EDCAC5]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__HUONG__41EDCAC5]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([HUONG_NHA])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__LOAI___42E1EEFE]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___42E1EEFE]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_NHA])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__LOAI___43D61337]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__LOAI___43D61337]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_CAP_NHA])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__CONG_TRIN__MA_HO__44CA3770]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__MA_HO__44CA3770]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG]  WITH CHECK ADD  CONSTRAINT [FK__CONG_TRIN__MA_HO__44CA3770] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__CONG_TRIN__MA_HO__44CA3770]') AND parent_object_id = OBJECT_ID(N'[dbo].[CONG_TRINH_XAY_DUNG]'))
ALTER TABLE [dbo].[CONG_TRINH_XAY_DUNG] CHECK CONSTRAINT [FK__CONG_TRIN__MA_HO__44CA3770]
GO
/****** Object:  ForeignKey [FK__DUONG_KHA__PHUON__46B27FE2]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHA__PHUON__46B27FE2]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT]  WITH CHECK ADD FOREIGN KEY([PHUONG])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__DUONG_KHAO__QUAN__45BE5BA9]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__DUONG_KHAO__QUAN__45BE5BA9]') AND parent_object_id = OBJECT_ID(N'[dbo].[DUONG_KHAO_SAT]'))
ALTER TABLE [dbo].[DUONG_KHAO_SAT]  WITH CHECK ADD FOREIGN KEY([QUAN])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__GIA_DOAN___MA_DK__47A6A41B]    Script Date: 09/17/2011 12:23:38 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_DOAN___MA_DK__47A6A41B]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_DOAN_DUONG]'))
ALTER TABLE [dbo].[GIA_DOAN_DUONG]  WITH CHECK ADD FOREIGN KEY([MA_DKS])
REFERENCES [dbo].[DUONG_KHAO_SAT] ([MA_DKS])
GO
/****** Object:  ForeignKey [FK__GIA_THAM___LOAI___489AC854]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___LOAI___489AC854]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH]  WITH CHECK ADD FOREIGN KEY([LOAI_THANH_TOAN])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__GIA_THAM___MA_HO__498EEC8D]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___MA_HO__498EEC8D]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH]  WITH CHECK ADD  CONSTRAINT [FK__GIA_THAM___MA_HO__498EEC8D] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__GIA_THAM___MA_HO__498EEC8D]') AND parent_object_id = OBJECT_ID(N'[dbo].[GIA_THAM_DINH]'))
ALTER TABLE [dbo].[GIA_THAM_DINH] CHECK CONSTRAINT [FK__GIA_THAM___MA_HO__498EEC8D]
GO
/****** Object:  ForeignKey [FK__HO_SO_THA__MA_DK__4A8310C6]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__MA_DK__4A8310C6]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH]  WITH CHECK ADD  CONSTRAINT [FK__HO_SO_THA__MA_DK__4A8310C6] FOREIGN KEY([MA_DKS])
REFERENCES [dbo].[DUONG_KHAO_SAT] ([MA_DKS])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__MA_DK__4A8310C6]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] CHECK CONSTRAINT [FK__HO_SO_THA__MA_DK__4A8310C6]
GO
/****** Object:  ForeignKey [FK__HO_SO_THA__TINH___4C6B5938]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__TINH___4C6B5938]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH]  WITH CHECK ADD  CONSTRAINT [FK__HO_SO_THA__TINH___4C6B5938] FOREIGN KEY([TINH_TRANG_PHAP_LY])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__HO_SO_THA__TINH___4C6B5938]') AND parent_object_id = OBJECT_ID(N'[dbo].[HO_SO_THAM_DINH]'))
ALTER TABLE [dbo].[HO_SO_THAM_DINH] CHECK CONSTRAINT [FK__HO_SO_THA__TINH___4C6B5938]
GO
/****** Object:  ForeignKey [FK__THONG_TIN__MA_HO__4D5F7D71]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THONG_TIN__MA_HO__4D5F7D71]') AND parent_object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]'))
ALTER TABLE [dbo].[THONG_TIN_VI_TRI]  WITH CHECK ADD  CONSTRAINT [FK__THONG_TIN__MA_HO__4D5F7D71] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THONG_TIN__MA_HO__4D5F7D71]') AND parent_object_id = OBJECT_ID(N'[dbo].[THONG_TIN_VI_TRI]'))
ALTER TABLE [dbo].[THONG_TIN_VI_TRI] CHECK CONSTRAINT [FK__THONG_TIN__MA_HO__4D5F7D71]
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_D__4E53A1AA]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_D__4E53A1AA]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT]  WITH CHECK ADD FOREIGN KEY([LOAI_DUONG_PHO])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_H__4F47C5E3]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__4F47C5E3]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT]  WITH CHECK ADD FOREIGN KEY([LOAI_HINH_DANG_THUA_DAT])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_H__503BEA1C]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_H__503BEA1C]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT]  WITH CHECK ADD FOREIGN KEY([LOAI_HEM])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__THUA_DAT__LOAI_L__51300E55]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__LOAI_L__51300E55]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT]  WITH CHECK ADD FOREIGN KEY([LOAI_LAN_DUONG])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__THUA_DAT__MA_HO___5224328E]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__MA_HO___5224328E]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT]  WITH CHECK ADD  CONSTRAINT [FK__THUA_DAT__MA_HO___5224328E] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__THUA_DAT__MA_HO___5224328E]') AND parent_object_id = OBJECT_ID(N'[dbo].[THUA_DAT]'))
ALTER TABLE [dbo].[THUA_DAT] CHECK CONSTRAINT [FK__THUA_DAT__MA_HO___5224328E]
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___531856C7]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___531856C7]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_KET_CAU_KHUNG])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___540C7B00]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___540C7B00]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_KET_CAU_MONG])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___55009F39]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55009F39]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_KET_CAU_TUONG_NHA])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___55F4C372]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___55F4C372]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_KET_CAU_NEN])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___56E8E7AB]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___56E8E7AB]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_KET_CAU_MAI])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___57DD0BE4]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___57DD0BE4]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_TRANG_TRI_NOI_THAT])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___LOAI___58D1301D]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___LOAI___58D1301D]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD FOREIGN KEY([LOAI_CONG_TRINH_XAY_DUNG])
REFERENCES [dbo].[THAM_SO] ([MA_THAM_SO])
GO
/****** Object:  ForeignKey [FK__VAT_LIEU___MA_HO__59C55456]    Script Date: 09/17/2011 12:23:39 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___MA_HO__59C55456]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG]  WITH CHECK ADD  CONSTRAINT [FK__VAT_LIEU___MA_HO__59C55456] FOREIGN KEY([MA_HO_SO])
REFERENCES [dbo].[HO_SO_THAM_DINH] ([MA_HO_SO])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__VAT_LIEU___MA_HO__59C55456]') AND parent_object_id = OBJECT_ID(N'[dbo].[VAT_LIEU_XAY_DUNG]'))
ALTER TABLE [dbo].[VAT_LIEU_XAY_DUNG] CHECK CONSTRAINT [FK__VAT_LIEU___MA_HO__59C55456]
GO
